package com.frxuexi.report

import com.frxuexi.lib_base.BaseRepository
import com.frxuexi.lib_base.entity.ApiResponse
import com.frxuexi.lib_http.HttpType
import com.frxuexi.lib_http.NetWorkFactory
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.Body
import javax.inject.Inject

@OptIn
class ReportRepository @Inject constructor():BaseRepository() {

    val apiService by lazy { NetWorkFactory.factory(HttpType.NONE).create(ApiService::class.java) }

    fun getReports(map: Map<String,Int>): Flow<ApiResponse<List<ReportEntity>>>{
        return apiService.getReports(mapToBody(map))
    }

    fun addReport(map: Map<String, Any>):Flow<ApiResponse<Any>>{
        return apiService.addReport(mapToBody(map))
    }
}